<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
		<script src="${contextPath}/scripts/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
		<script src="${contextPath}/scripts/common.js" type="text/javascript"></script>
		<script src="${contextPath}/scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
		<link href="${contextPath}/styles/default.css" rel="stylesheet" type="text/css" />
		<script src="${contextPath}/scripts/scriptvalidator.js" type="text/javascript"></script>
</head>
<body>
<div class="navigation">
	    <span><a href="javascript:window.history.back();"><img src="${contextPath}/images/back_nav_btn.png" /></a>
	    <a href="javascript:window.history.back();">返回</a>
	    <a href="javascript:window.history.forward();"><img src="${contextPath}/images/go_nav_btn.png" /></a>
	     <a href="javascript:window.history.forward();">前进</a>
	    <a href="javascript:window.location.reload();"><img src="${contextPath}/images/refresh_nav_btn.png" /></a>
	     <a href="javascript:window.location.reload();">刷新</a>
 	    </span>管理费&gt;&gt;发票申请&gt;&gt;预收管理费
    
  	</div>
<form name="form1" method="post" onSubmit="return checkSubmit();"  action="addBillOpention.do">
<input type="hidden" name="id" value='<s:property value='bill.id'/>'/>
<input type="hidden" name="financialId" value='<s:property value='bill.financial.id'/>'/>
<input type="hidden" name="redirectUrl" value='<s:property value='redirectUrl'/>'/>
<input type="hidden" name="shopName" value="${shopName }">

<input type="hidden" name="billOption.shop.id" id="shopId">
     <table  width="100%" border="0" align="left" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
    <tr>
      <td width="25%"  class="top-td-width-bg">销售店</td>
      <td width="25%"  class="down-center-td-width-bg">
      <table width="200" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="50%"><input onKeyUp="doAjaxTest()" class="input_readonly" dataType="Require" readonly="true" msg="请选择销售店 " type="text" name="vg" id="shop"></td>
            <td  width="50%"><a href="javascript:show(<s:property value='bill.financial.id'/>)"><img src="${contextPath}/images/chakan.gif" alt="详细" width="16" height="13" border="0" /></a></td>
          </tr>
      </table></td>
      <td  width="25%"  class="top-td-width-bg">收取月份</td>
      <td  width="25%" class="down-center-td-width-bg">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td  width="50%"><input datatype="Require" id="month" msg="请输入收取月份" onBlur="doAjaxTest(<s:property value='bill.financial.id'/>)" class="Wdate"   type="text" name="billOption.month" winth="200px" onFocus="WdatePicker({dateFmt:'yyyy-MM'})" readonly="true"/></td>
          <td  width="50%" ><div id="div12" style="color:#F00;font-size:10px;" ></div></td>
          </tr>
      </table>
</td>
    </tr>
    <tr>
      <td width="25%" class="top-td-width-bg">应收金额</td>
      <td width="25%" class="down-center-td-width-bg"><input class="input"  dataType="Require|Double" msg="请输入应收金额|请输入数字"  type="text" name="billOption.amount"></td>
      <td width="25%" class="top-td-width-bg">备注</td>
      <td width="25%" class="down-center-td-width-bg"><input class="input"  type="text" name="billOption.remark"></td>
    </tr>
    <tr>
      <td colspan="4" align="center">
      <input type="submit" name="button" class="btn_qd" id="button" value=""></td>
    </tr>
  </table>
</form>
<script language='javascript'>
var monthj=true;
function contrast(){
	var myDate = new Date();
	var a = myDate.getFullYear()+myDate.getMonth()+1;    //获取完整的年份(4位,1970-????)
	var strs = new Array(); //定义一数组
	
	var b = document.getElementById("month").value;
	var c = strs[0]+strs[1];

	strs = b.split("-");
	alert(a);
	alert(strs[0]+strs[1]);
	alert(c);
}
function checkSubmit(){
 	var staffForm = document.form1;
	if(!Validator.Validate(staffForm, 3)) {
		return false;
	}
	if(monthj ==true){
		return true;
	}else{
		return false;
	}
	
 }
function show(id){
	window.open("selectShop.do?financialId="+id, "newwindow", "height=450, width=700, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no");
	}
function selectShopCallBack(hao, ming, id){
	 document.getElementById("shop").value="("+hao+"/"+ming+")";
	 document.getElementById("shopId").value=id;
	 this.doAjaxTest();
	}
function doAjaxTest(Fid){
	var name =document.getElementById("shop").value;
	var shopId =document.getElementById("shopId").value;
	var month =document.getElementById("month").value;
	if(name != null && name.length > 0 && month != null && month.length > 0){
		$.ajax({
			  async:false,
			  type: 'POST',
			  url:"<s:property value='contextPath'/>/mf/apply/keyBillOpention.do?shopId="+shopId+"&month="+month+"&financialId="+Fid,
			  dataType: "json",
			  success: function(data) {
				  var a=data.toString();
				  if(a =="null"){
					  document.getElementById("div12").innerHTML="";
					  monthj=true;
				  }else{
					  document.getElementById("div12").innerHTML=a; 
					   document.getElementById("div12").style.display="inline";
					  monthj=false;
				  }
					  
			  }
			});
	}
	
}
</script>
</body>
</html>